// 导入网络相关的函数
import {

  getSwiper,
  homeGetGoods
} from '../../service/home.js'

Page({
	data: {
    swiper: [],
    goodsData:[]

	},
	onLoad() {
		this._getSwiper()
		this._homeGetGoods()

	},
	_getSwiper() {
		// getSwiper().then(res=>{
		// console.log(res.data.message);
		//   this.setData({
		//     swiper:res.data.message
		//   })

		// })
		getSwiper().then((res) => {

			this.setData({
        swiper: res.data.data,
      })

      
		})
  },
  _homeGetGoods(){
    homeGetGoods().then(res=>{
      this.setData({
        goodsData:res.data.data
      })
    })

  },

	swiperClick(e) {

    // console.log(e);
    const { index } = e.detail
    // console.log(index);
		// const url = this.data.swiper[index].navigator_url.split('=')[1]
    console.log();
		wx.navigateTo({
			url: '/pages/goods-detail/goods-detail?gid=' +this.data.swiper[index].gid,
		})
	},
})
